"""
本地有约主应用 URL 配置
包含核心功能的路由
"""
from django.contrib import admin
from django.urls import path, include

from Location import views

app_name = 'location'
urlpatterns = [
    # 首页
    path('index/', views.index, name='index'),
    path('api/event-image/<int:event_id>/', views.get_event_image_url, name='event_image_url'),

    # API 接口
    path('api/nearby-activities/', views.get_nearby_activities, name='nearby_activities'),
    path('api/search-activities/', views.search_activities, name='search_activities'),
    path('api/user-location/', views.get_user_location, name='user_location'),

    # # 新增的搜索和分类API
    # path('api/search-activities-map/', views.search_activities_api, name='search_activities_api'),
    path('api/categories/', views.get_categories_api, name='get_categories'),

    # 活动页
    path('activities/', views.activity_list, name='activity_list'),
    path('activities/map/', views.activities_map, name='activities_map'),

    # 生成
    path('activity/create/',views.activity_create,name='activity_create'),

    # 活动详情页 - 支持带ID和不带ID两种访问方式
    path('activity_detail/<int:event_id>/', views.activity_detail, name='activity_detail'),
    path('activity_detail/', views.activity_detail, name='activity_detail_default'),
    path('api/comments/like/', views.like_discussion, name='like_discussion'),
    path('api/comments/dislike/', views.dislike_discussion, name='dislike_discussion'),
    path('api/comments/', views.create_discussion, name='create_discussion'),
    path('api/comments/<int:discussion_id>/', views.delete_discussion, name='delete_discussion'),
    path('api/events/<int:event_id>/comments/', views.get_discussions, name='get_discussions'),
    path('api/reviews/submit/', views.submit_review, name='submit_review'),
    # 报名
    path('register/<int:event_id>/', views.register_event, name='register_event'),
    path('api/register/', views.register_event_api, name='register_event_api'),

    # 社区讨论
    path('community/', views.community_home, name='community_home'),
    path('community/posts/', views.community_posts, name='community_posts'),
    path('community/post/create/', views.create_post, name='create_post'),
    path('community/post/<int:post_id>/', views.post_detail, name='post_detail'),
    path('community/post/<int:post_id>/comment/', views.add_comment, name='add_comment'),
    path('community/post/<int:post_id>/like/', views.toggle_post_like, name='toggle_post_like'),
    path('community/comment/<int:comment_id>/like/', views.toggle_comment_like, name='toggle_comment_like'),
    #删除评论
    path('community/comment/<int:comment_id>/delete/', views.delete_comment, name='delete_comment'),
    # 社交功能
    path('social/follow/<int:user_id>/', views.toggle_follow, name='toggle_follow'),
    path('social/messages/', views.message_list, name='message_list'),
    path('social/messages/conversations/json/', views.message_conversations_json, name='message_conversations_json'),
    path('social/messages/<int:user_id>/', views.message_thread, name='message_thread'),
    path('social/messages/send/', views.send_message, name='send_message'),
    path('api/recommended-users/', views.recommended_users_api, name='recommended_users_api'),#推荐用户
    path('social/activities/', views.user_activities, name='user_activities'),
    path('social/profile/<int:user_id>/', views.user_profile, name='user_profile'),
    # 草稿箱相关
    path('community/drafts/', views.draft_list, name='draft_list'),
    path('community/draft/<int:draft_id>/edit/', views.edit_draft, name='edit_draft'),
    path('community/draft/<int:draft_id>/delete/', views.delete_draft, name='delete_draft'),
    path('community/draft/<int:draft_id>/restore/', views.restore_draft, name='restore_draft'),

    path('community/post/<int:post_id>/report/', views.report_post, name='report_post'),#举报帖子
    path('community/post/<int:post_id>/edit/', views.edit_post, name='edit_post'),#编辑帖子
    path('community/post/<int:post_id>/delete/', views.delete_post, name='delete_post'),#删除帖子
    # 积分相关URL
    path('points/history/', views.point_history, name='point_history'),
    path('points/rules/', views.point_rules, name='point_rules'),
    path('api/points/summary/', views.user_points_summary, name='user_points_summary'),
    # 签到相关路由
    path('api/checkin/', views.checkin_event, name='checkin_event'),
    path('events/<int:event_id>/checkin-list/', views.checkin_list, name='checkin_list'),
    path('events/<int:event_id>/checkin-list/', views.checkin_list, name='checkin_list'),
    # 积分商城相关URL
    path('rewards/', views.reward_mall, name='reward_mall'),
    path('rewards/<int:reward_id>/', views.reward_detail, name='reward_detail'),
    path('rewards/<int:reward_id>/redeem/', views.redeem_reward, name='redeem_reward'),
    path('redemption/history/', views.redemption_history, name='redemption_history'),
    path('redemption/<int:redemption_id>/', views.redemption_detail, name='redemption_detail'),
    path('debug/event-points/', views.debug_event_points, name='debug_event_points'),
    path('debug/event-points/<int:event_id>/', views.debug_event_points, name='debug_event_points_detail'),
]